<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>
        shu
    </title>
</head>
<body>
    <style>
        .one{
            height: 50px;
            width: 300px;
            margin: 0 auto;
        }
    </style>
    <script>
        function jiafa(){
            var shu = document.getElementById('two');
            if(shu.value<1000)
            {
                shu.value++;
            }
            else{
                alert("不行不行，不能再加啦!!");
            }
        }
        function jianfa(){
            var shu = document.getElementById('two');
            if(shu.value>0)
            {
                shu.value--;
            }
            else{
                alert("不行不行，减不下去啦！！");
            }
        }
    </script>
    <div class="one">
        <input type="button" value="-" onclick="jianfa()"/>
        <input type="text" value="5" id="two"/>
        <input type="button" value="+" onclick="jiafa()"/>
    </div>
</body>